import http from "@/api";

import { ResPage } from "@/api/interface";

import {
  WorkerVo,
  CompanyGroupVo,
  CompanyGroupEntity,
  WorkerReportEntity,
  WorkerMarkerEntity,
  WorkerReportVo
} from "@/biz/interface/WorkerType";

import { ModuleMainUrl } from "..";

const moduleUrl = ModuleMainUrl;

// * 获取工友列表
export const getWorkerVoListApi = (params: {}) => {
  return http.post<ResPage<WorkerVo>>(moduleUrl + `/cpyswk/wkinfo`, params);
};

// * 获取当前企业的工友分组
export const getWorkerGroupsApi = (params: {}) => {
  return http.post<ResPage<CompanyGroupVo>>(moduleUrl + `/cpyswk/wgroups`, params);
};

// * 新增工友分组
export const saveCompanyGroupApi = (wgroup: CompanyGroupEntity) => {
  return http.post(moduleUrl + `/cpyswk/wgsave`, wgroup);
};

// * 设置工友分组
export const setCompanyGroupApi = (params: { groupId: string; ids: string[] }) => {
  return http.post(moduleUrl + `/cpyswk/wgset`, params);
};

export const setCompanyWorkerGroupApi = (params: { groupId: string; workerId: string }) => {
  return http.post(moduleUrl + `/cpyswk/workersetgroup`, params);
};

// * 将用户从组中删除
export const deleteWorkerFromCGApi = (wgroup: CompanyGroupEntity) => {
  return http.post(moduleUrl + `/cpyswk/mgrdelete`, wgroup);
};

// * 获取企业与工友的状态
export const saveCompanyWorkerStatusApi = (wgroup: WorkerStatusEntity) => {
  return http.post(moduleUrl + `/cpyswk/ckstatussave`, wgroup);
};

// * 标注工友标注
export const saveWorkerMarkerApi = (wmarker: WorkerMarkerEntity) => {
  return http.post(moduleUrl + `/cpyswk/workermaker`, wmarker);
};

// * 获取企业与工友的状态
export const infoCompanyWorkerStatusApi = (params: { id: string }) => {
  return http.post<WorkerReportEntity>(moduleUrl + `/cpyswk/ckstatusinfo`, params);
};

// * 获取感兴趣的工列表
export const getWorkerCollectApi = (params: {}) => {
  return http.post<ResPage<WorkerVo>>(moduleUrl + `/cpyswk/workercollect`, params);
};

export const getWorkerApplyApi = (params: {}) => {
  return http.post<ResPage<WorkerVo>>(moduleUrl + `/cpyswk/workerapply`, params);
};

export const getWorkerViewApi = (params: {}) => {
  return http.post<ResPage<WorkerVo>>(moduleUrl + `/cpyswk/workerview`, params);
};

export const getWorkerDownloadApi = (params: {}) => {
  return http.post<ResPage<WorkerVo>>(moduleUrl + `/cpyswk/cpydownloadworkers`, params);
};

// * 举报工友
export const saveWorkerReportApi = (wreport: WorkerReportEntity) => {
  return http.post(moduleUrl + `/cpymsg/reportsave`, wreport);
};

// * 举报工友 - 详情
export const infoWorkerReportApi = (params: { id: string }) => {
  return http.post<WorkerReportEntity>(moduleUrl + `/cpymsg/reportinfo`, params);
};

// * 获取企业举报列表
export const companyReportVoListApi = (params: {}) => {
  return http.post<WorkerReportVo>(moduleUrl + `/cpymsg/reportvolist`, params);
};

// * 获取企业举报列表
export const deleteCompanyReportApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpymsg/reportdelete`, params);
};
